#include "ThreadPool.hpp"
#include <iostream>
#include <unistd.h>
#include "Task.hpp"
#include "Log.hpp"
using namespace log_ns;
int main()
{
    //     srand(time(nullptr) ^ getpid());
    //    for(int i = 0;i<5;i++)
    //     {
    //         Task task(rand()%10,rand()%10);
    //         ThreadPool<Task>::GetThreadPoolPtr()->Equeue(task);
    //         sleep(1);
    //     }
    //     ThreadPool<Task>::GetThreadPoolPtr()->stop();
    //     delete ThreadPool<Task>::GetThreadPoolPtr();

    srand(time(nullptr) ^ getpid());

    ThreadPool<Task> *threads = new ThreadPool<Task>;

    threads->init();
    threads->start();

    for (int i = 0; i < 5; i++)
    {
        Task task(rand() % 10, rand() % 10);
        threads->Equeue(task);
        usleep(100000);
    }
    threads->stop();
    sleep(3);
    delete threads;

    return 0;
}